package cate.game.role.login.msg;

import cate.game.GameBody;
import cate.game.client.ClientContext;
import cate.game.client.msg.ClientMsg;
import cate.game.client.msg.MsgConfig;
import cate.game.client.msg.MsgInput;
import cate.game.client.msg.id.MsgIdBLogin;
import cate.game.event.master.RoleInitEvent;
import lombok.extern.slf4j.Slf4j;

@Slf4j
@ClientMsg(title = "角色初始化数据（非客户端懒请求数据） の 请求")
public class RoleInitReq implements MsgInput{

    @Override
    public MsgConfig conf() {
        return MsgIdBLogin.ROLE_INIT_REQ;
    }

    @Override
    public void execute(GameBody game, ClientContext cc) {
        game.eventDispatcher.dispatchEvent(new RoleInitEvent(cc.getRole()));
        RoleInitDoneResp doneResp = new RoleInitDoneResp();
        cc.getRole().sendNow(doneResp);
        game.stat.whenOnline(cc.getRole());
    }
}
